package com.hskn.hss.module.empPlan.to;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hskn.hss.utils.Tools;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * 作业计划汇总报表TO
 *
 * @author zcy
 * @date 2021/10/9 13:21
 */
@Data
@ApiModel(value = "作业计划汇总报表列表-TO", description = "作业计划汇总报表列表-TO")
public class EmpPlanSummaryTableTO implements Serializable {
    @ApiModelProperty(value = "机构ID", name = "depId", example = "02eb9c47bd9944c788b2f00407efbc3e")
    private String depId;
    @ApiModelProperty(value = "网格名称", name = "gridId")
    private String gridId;
    @ApiModelProperty(value = "人员Id", name = "empId")
    private String empId;
    @ApiModelProperty(value = "计划Id", name = "planId")
    private String planId;
    @ApiModelProperty(value = "计划名称", name = "planName")
    private String planName;
    @ApiModelProperty(value = "开始时间", name = "startTime", example = "2021-09-22")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startTime;
    @ApiModelProperty(value = "结束时间", name = "endTime", example = "2021-09-22")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endTime;
    @ApiModelProperty(value = "页数", name = "page", example = "1")
    private Integer page;

    @ApiModelProperty(value = "页面大小", name = "size", example = "10")
    private Integer size;

    public Integer getPage() {
        if(Objects.isNull(page)){
            return 1;
        }
        return page;
    }

    public Integer getSize() {
        if(Objects.isNull(size)){
            return 20;
        }
        return size;
    }

    public Date getStartTime() {
        if(Objects.isNull(startTime)){
            return Tools.getFristDayForDate(new Date());
        }
        return Tools.getDateForBegin(startTime);
    }

    public Date getEndTime() {
        if(Objects.isNull(endTime)){
            return Tools.getLastDayForDate(new Date());
        }
        return Tools.getDateForEnd(endTime);
    }
//    /**
//     * 作业计划汇总导出用TO追加
//     */
//    @ApiModelProperty(value = "导出列表类型 1:机构,2:作业,3:车型", name = "oilType", example = "1")
//    private Integer oilType;
//    @ApiModelProperty(value = "车辆类型ID集合", name = "carTypeIds", example = "02eb9c47bd9944c788b2f00407efbc3e")
//    private List<String> carTypeIds;
//    @ApiModelProperty(value = "机构ID集合", name = "deptidforcarIds", example = "02eb9c47bd9944c788b2f00407efbc3e")
//    private List<String> deptidforcarIds;
//    @ApiModelProperty(value = "作业类型集合", name = "deptidforcarTypes", example = "项目")
//    private List<String> carcategoryNames;

}
